<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .sliderbar {
            position: fixed;
            right: 0;
            bottom: 100px;
            width: 40px;
            height: 40px;
            text-align: center;
            line-height: 40px;
            cursor: pointer;
            color: #fff;
        }

        .con {
            position: absolute;
            left: 0;
            top: 0;
            width: 200px;
            height: 40px;
            background-color: purple;
            z-index: -1;
        }
    </style>
    <script src="animate.js"></script>
</head>
<body>
<div class="sliderbar">
    <span>←</span>
    <div class="con">问题反馈</div>
</div>
<script>
    var sliderbar = document.querySelector('.sliderbar');
    var con = document.querySelector('.con');
    var span = document.querySelector('span');
    // 当我们鼠标经过 sliderbar 就会让 con这个盒子滑动到左侧
    // 当我们鼠标离开 sliderbar 就会让 con这个盒子滑动到右侧
    sliderbar.addEventListener('mouseenter',function () {
        animate(con,-160,function () {
            //当我们动画执行完毕,就把←箭头改为→箭头
            sliderbar.children[0].innerHTML = '→';
        });
    })
    sliderbar.addEventListener('mouseleave',function () {
        animate(con,0,function () {
            sliderbar.children[0].innerHTML = '←';
        });

    })
</script>
</body>
</html>
